package com.adie.controller;


import com.adie.mapper.UserMapper;
import com.adie.pojo.OldMan;
import com.adie.pojo.Volunteer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class JDBCController {
    @Autowired
    private UserMapper userMapper;

    @GetMapping("/queryOldManList")
    public List<OldMan> queryOldManList(){
        List<OldMan>oldManList= userMapper.queryOldManList();
        return oldManList;
    }

    @PostMapping("/addOldManList")
    public String addOldMan(@RequestBody OldMan oldMan){
        System.out.println(oldMan);
        userMapper.addOldMan(oldMan);
        return "添加了一位失踪老人";
    }

    public Volunteer queryVolunteer(String openid_volunteer){
        Volunteer volunteer = userMapper.queryVolunteer(openid_volunteer);
        return volunteer;
    }



}
